[DllImport("coredll.dll", SetLastError=true)]
private static extern int GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize);
Declare Function GetModuleFileName Lib "coredll.dll" (ByVal hModule As IntPtr, ByVal lpFileName As System.Text.StringBuilder, ByVal nSize As Int32) As Int32
None.
This is used internally by the static property System.Windows.Forms.Application.ExecutablePath
Taken from OpenNETCF.Reflection.AssemblyEx
Please add some!
class CoreDllWrapper
{
[DllImport("coredll.dll", SetLastError = true)]
public static extern int GetModuleFileName(IntPtr hModule, StringBuilder lpFilename, int nSize);
}
// Will write the current executable's complete path into exePath
StringBuilder exePath = new StringBuilder(1024);
int exePathLen = CoreDllWrapper.GetModuleFileName(IntPtr.Zero, exePath, exePath.Capacity);